#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#define N 3
int main()
{
	int x = 0, y = N/2,t = 1;
	int arr[N][N] = { 0 };
	arr[x][y] = 1;
	while (t < N * N)
	{
		int x1 = x, y1 = y;
		x = (x + 2) % N;
		y = (y + 1) % N;
		if (arr[x][y] != 0)
		{
			x = (x1 + 1) % N;
				y = y1;
		}
		arr[x][y] = ++t;
	}
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < N; j++)
		{
			printf("%d ", arr[i][j]);
		}
		printf("\n");
	}
	return 0;
}